Electrical machines, including motors and generators, generate heat during operation. To cool the electrical machine, air or liquid coolant may be directed through an exterior housing that surrounds the electrical machine, for example. During operation of the electrical machine, air or liquid coolant flows through the exterior housing, absorbing and carrying away heat from the electrical machine. As another example, the electrical machine may be submerged in a liquid coolant during operation.